const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    username:'',
    phone:'',
    goodsList:2,
    couponList:[
      {
        id:1,
        title:"优惠券列表",
        start:'2020-06-01',
        end:'2020-06-24',
        desc:'',
        condition:100,
        price:20,//优惠金额
        cate:12,
        cateText:'',
        type:0,
      },{
        id:2,
        title:"优惠券列表",
        start:'2020-06-01',
        end:'2020-06-24',
        desc:'',
        condition:100,
        price:20,//优惠金额
        cate:12,
        cateText:'',
        type:0,
      },{
        id:3,
        title:"优惠券列表",
        start:'2020-06-01',
        end:'2020-06-24',
        desc:'',
        condition:100,
        price:20,//优惠金额
        cate:12,
        cateText:'',
        type:0,
      }
    ],
    selected:'',
    mobile:'1318969xxxx',

    couponShow:false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  getCoupon(){
    this.setData({
      couponShow:true
    })
  },
  onCoupon(e){
    this.setData({
      selected:e.detail.name
    })
  },
  onCouponCancel(){
    this.setData({
      selected:''
    })
  },
  toMobile(){
    wx.makePhoneCall({
      phoneNumber: this.data.mobile
    })
  },
  // 
  onSubmit(){
    wx.showModal({
      title: '提示',
      content: '跳转到成功或失败页面!',
      showCancel: true,
      cancelText: '失败页面',
      cancelColor: '#000000',
      confirmText: '成功页面',
      confirmColor: '#3CC51F',
      success: (result) => {
        if (result.confirm) {
          wx.redirectTo({
            url: '/pages_subpack/pay_success/pay_success?orderid=100'
          });
        }else{
          wx.redirectTo({
            url: '/pages_subpack/pay_error/pay_error?orderid=100'
          });
        }
      },
      fail: () => {},
      complete: () => {}
    });
      
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})